//
//  RollOutToBalanceVC.m
//  NtoccShipper
//
//  Created by mac on 2020/2/17.
//  Copyright © 2020 zhuchongjin. All rights reserved.
//

#import "RollOutToBalanceVC.h"

@interface RollOutToBalanceVC ()
@property (nonatomic,strong) CJTextField *fieldlimitMoney;
@property (nonatomic,strong) CJTextField *fieldRollOutMoney;
@end

@implementation RollOutToBalanceVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self setTitleName:CJLString(@"转入到余额")];
    [self setBackLeftButton:@""];
    [self createTableView];
    [self setFeildLimit];
}
- (void)createTableView{
    
    //
    NSString *strType = @"RollOutToBalanceView";
    CGRect rcFrame = CGRectMake(0, kTopHeight, [[UIScreen mainScreen] bounds].size.width, 0);
    FlexFrameView *header = [[FlexFrameView alloc] initWithFlex:strType Frame:rcFrame Owner:self];
    header.flexibleHeight = YES;
    //        self.labTitle.text = @"您已通过实名认证";
    self.fieldlimitMoney.text = self.strEnsureFee;
    [header layoutIfNeeded];
    [self.view addSubview:header];
}

- (void)setFeildLimit{
    self.fieldRollOutMoney.textFieldType = CJTextFieldStringTypeMoneyValue;
    self.fieldRollOutMoney.maxLength = CJTextLengthTen;
}
- (void)btnRollOutToBalanceAction{
    
    if ([CJRegular getIsStrEmpty:self.fieldRollOutMoney.text]) {
        [CJAlert showStringDismissWithDelay:@"请填写转出金额"];
    }else if (![CJRegular getIsMonayValue:self.fieldRollOutMoney.text]){
        [CJAlert showStringDismissWithDelay:@"请填写正确类型金额"];

    }else{
        
        NSString *strUrl = CJStringWithFormat(@"%@/ntocc-basic-api/shipment/minusInsureFeeAmount",CJBaseUrl);
        NSDictionary *dicPra = @{
            @"fee":self.fieldRollOutMoney.text
        };
        @weakify(self);
        [[HDNetworking sharedHDNetworking] PUT:strUrl parameters:dicPra success:^(id  _Nonnull responseObject) {
            
//            DLog(@"=====%@",responseObject);
            @strongify(self);
            [self pop];
            
        } failure:^(NSError * _Nonnull error) {
            
        }];
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
